home *** CD-ROM | disk | FTP | other *** search
- function BallXY(MC)
- {
- d = this.radius - MC.r / 360 * 50;
- var _loc3_ = MC.r * 3.141592653589793 / 180;
- MC._x = d * Math.cos(_loc3_) + this.centerX;
- MC._y = d * Math.sin(_loc3_) + this.centerY;
- if(MC.r > this.maxRotation)
- {
- MC.removeMovieClip();
- }
- }
- function distanceMC(MC1, MC2)
- {
- if(MC1 != undefined && MC2 != undefined)
- {
- var _loc2_ = MC1._x - MC2._x;
- var _loc1_ = MC1._y - MC2._y;
- return Math.sqrt(_loc2_ * _loc2_ + _loc1_ * _loc1_);
- }
- return 1000;
- }
- function rotationMC(MC)
- {
- var _loc3_ = MC._x - centerX;
- var _loc2_ = MC._y - centerY;
- var _loc1_ = Math.atan2(_loc2_,_loc3_) * 180 / 3.141592653589793;
- if(_loc1_ < 0)
- {
- return 360 + _loc1_;
- }
- return _loc1_;
- }
- function rotationXY(x1, y1, x2, y2)
- {
- var _loc3_ = x1 - x2;
- var _loc2_ = y1 - y2;
- var _loc1_ = Math.atan2(_loc2_,_loc3_) * 180 / 3.141592653589793;
- if(_loc1_ < 0)
- {
- return 360 + _loc1_;
- }
- return _loc1_;
- }
- function MouseLine()
- {
- var _loc3_ = this.rotationXY(_parent._xmouse,_parent._ymouse,this.lineMC._x,this.lineMC._y);
- this.lineMC._rotation = _loc3_;
- if(_loc3_ < 0)
- {
- _loc3_ += 360;
- }
- this.lineMC.BOX._x = this.radius - _loc3_ / 360 * 50 + this.ballRadius / 2;
- }
- function unSet()
- {
- this.gameplay = false;
- if(_parent.GAMEOVER != undefined)
- {
- _parent.GAMEOVER.removeMovieClip();
- }
- var _loc3_ = this.prevMC;
- while(true)
- {
- if(_loc3_.prevMC == undefined)
- {
- _loc3_.removeMovieClip();
- break;
- }
- _loc3_ = _loc3_.prevMC;
- _loc3_.nextMC.removeMovieClip();
- }
- this.prevMC = undefined;
- this.centerMC.removeMovieClip();
- this.centerTmp.removeMovieClip();
- this.screwTmp.removeMovieClip();
- this.centerMC = undefined;
- this.centerTmp = undefined;
- this.screwTmp = undefined;
- stopAllSounds();
- }
- function GameStart()
- {
- this.Setup();
- }
- function Setup()
- {
- this.unSet();
- var _loc3_ = 0;
- var _loc2_ = 0;
- while(_loc2_ < 20000)
- {
- d = this.radius - _loc3_ / 360 * this.maxDistance;
- _loc3_ += Math.atan2(1,d) * 180 / 3.141592653589793;
- var _loc4_ = _loc3_ * 3.141592653589793 / 180;
- var _loc6_ = Math.round((d * Math.cos(_loc4_) + this.centerX) * 10) / 10;
- var _loc5_ = Math.round((d * Math.sin(_loc4_) + this.centerY) * 10) / 10;
- this.circleXY[_loc2_] = [_loc6_,_loc5_];
- if(_loc3_ > this.maxRotation)
- {
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- this.centerTmp = this.gameMC.attachMovie(this.ballName,"centerTmp",this.Depths);
- this.centerTmp._x = this.gameMC[this.centerName]._x;
- this.centerTmp._y = this.gameMC[this.centerName]._y;
- this.centerTmp.gotoAndStop(this.AddBallFrame());
- this.screwTmp = this.gameMC.attachMovie(this.ballName,"screwTmp",this.Depths + 1);
- this.screwTmp._x = this.gameMC[this.nextName]._x;
- this.screwTmp._y = this.gameMC[this.nextName]._y;
- this.screwTmp.gotoAndStop(this.AddBallFrame());
- this.lineMC._x = this.centerX;
- this.lineMC._y = this.centerY;
- this.lineMC.swapDepths(this.Depths + this.Bmax + 2);
- this.slotMC.tx = this.slotMC._x;
- this.slotMC.ty = this.slotMC._y;
- this.slotMC.swapDepths(this.Depths + this.Bmax + 3);
- this.gameMC.HELP.swapDepths(this.Depths + this.Bmax + 4);
- this.gameMC.PAUSE.swapDepths(this.Depths + this.Bmax + 5);
- this.shoot = false;
- this.shootMove = 0;
- this.Bnum = 1;
- this.comboNum = 0;
- this.maxCombo = 0;
- this.TotalScore = 0;
- this.CountBall = 0;
- this.displayScore();
- this.gameplay = true;
- this.soundPlay("title",1);
- this.startMC.gotoAndStop("OFF");
- this.startTime = getTimer();
- if(this._visible == true)
- {
- this._visible = false;
- }
- }
- function GameOver()
- {
- this.gameplay = false;
- var _loc3_ = Math.floor((getTimer() - this.startTime) / 1000);
- trace("play_time - " + _loc3_);
- if(_root.uid == undefined || _root.ot1 == undefined || this.TotalScore <= 0 || this.TotalScore == undefined || _loc3_ <= 0 || _loc3_ == undefined)
- {
- trace("잘못된 값이 들어옴 this.TotalScore : " + this.TotalScore + "play_time:" + _loc3_ + " this.startTime" + this.startTime);
- gameRankView();
- }
- else
- {
- trace("랭킹연결");
- this._parent.scoreSendDB(_root.ot1,_root.uid,this.TotalScore,_loc3_);
- }
- }
- function gameRankView(nickName, rankNum)
- {
- if(!nickName)
- {
- var _loc3_ = _parent.attachMovie(this.gameoverName,"GAMEOVER",this.Depths + 20001);
- _loc3_._x = this.centerX;
- _loc3_._y = this.centerY;
- _loc3_._visible = true;
- this.startMC._y = _loc3_._y + 100;
- this.startMC.gotoAndStop("ON");
- }
- else
- {
- _loc3_ = _parent.attachMovie(this.gameoverRank,"GAMEOVER",this.Depths + 20001);
- _loc3_._x = this.centerX - 100;
- _loc3_._y = this.centerY;
- _loc3_._visible = true;
- _loc3_.my_nickName = nickName;
- _loc3_.my_score = this.TotalScore;
- _loc3_.my_gameRank = rankNum;
- }
- this.soundPlay("title",1);
- }
- function AddBallFrame()
- {
- var _loc4_ = 0;
- if(random(lightningRand) == 0)
- {
- _loc4_ = lightningFrame;
- }
- else
- {
- var _loc3_ = this.ballMaxCount;
- var _loc2_ = 0;
- while(_loc2_ < this.ballMaxArr.length)
- {
- if(this.ballMaxArr[_loc2_] > this.CountBall)
- {
- _loc3_ = _loc2_ + this.ballMaxMin;
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- if(_loc3_ > this.ballMaxCount)
- {
- _loc3_ = this.ballMaxCount;
- }
- _loc4_ = random(_loc3_) + 1;
- this.ballMaxNum = _loc3_;
- }
- return _loc4_;
- }
- function AddBall(mv)
- {
- var _loc3_ = this.gameMC.attachMovie(this.ballName,"B" + this.Bnum,this.Bnum + this.Depths + 2);
- _loc3_.Bnum = this.Bnum;
- this.Bnum = this.Bnum + 1;
- if(this.Bnum >= this.Bmax)
- {
- this.Bnum = 1;
- }
- _loc3_.num = -10;
- _loc3_.mv = mv;
- _loc3_.prevMC = undefined;
- _loc3_.nextMC = undefined;
- if(mv == 0)
- {
- _loc3_._x = this.centerX;
- _loc3_._y = this.centerY;
- }
- else
- {
- _loc3_._x = _parent.AS.circleXY[_loc3_.num][0];
- _loc3_._y = _parent.AS.circleXY[_loc3_.num][1];
- }
- _loc3_.gotoAndStop(this.AddBallFrame());
- return _loc3_;
- }
- function AddCenterBall()
- {
- var _loc2_ = this.AddBall(0);
- _loc2_.swapDepths(this.Depths + this.Bmax + 1);
- this.centerMC = _loc2_;
- this.shoot = false;
- _loc2_.gotoAndStop(this.centerTmp._currentframe);
- this.centerTmp.gotoAndStop(this.AddBallFrame());
- }
- function AddScrewBall()
- {
- var _loc2_ = this.AddBall(1);
- if(this.prevMC != undefined)
- {
- _loc2_.prevMC = this.prevMC;
- this.prevMC.nextMC = _loc2_;
- }
- this.prevMC = _loc2_;
- _loc2_.gotoAndStop(this.screwTmp._currentframe);
- this.screwTmp.gotoAndStop(this.AddBallFrame());
- }
- function displayScore()
- {
- _parent.scoreMC.TXT = this.TotalScore;
- }
- function deleteBall(tMC, score)
- {
- if(tMC != undefined)
- {
- if(tMC.prevMC != undefined)
- {
- tMC.prevMC.nextMC = tMC.nextMC;
- }
- if(tMC.nextMC != undefined)
- {
- tMC.nextMC.prevMC = tMC.prevMC;
- }
- else
- {
- this.prevMC = tMC.prevMC;
- tMC.prevMC.nextMC = undefined;
- }
- if(score > 0)
- {
- this.CountBall = this.CountBall + 1;
- var _loc3_ = this.gameMC.attachMovie(this.boxName,"box" + tMC.Bnum,this.Depths + tMC.Bnum + 5000);
- _loc3_._x = tMC._x;
- _loc3_._y = tMC._y;
- _loc3_.TXT = score;
- this.TotalScore += score;
- this.displayScore();
- }
- tMC.removeMovieClip();
- }
- }
- function insertBall(tMC)
- {
- if(tMC != undefined)
- {
- var _loc3_ = this.rotationMC(tMC);
- if(_loc3_ < this.shootRotation)
- {
- this.centerMC.num = tMC.num + this.ballRadius;
- this.centerMC.prevMC = tMC.prevMC;
- this.centerMC.nextMC = tMC;
- if(tMC.prevMC != undefined)
- {
- tMC.prevMC.nextMC = this.centerMC;
- }
- tMC.prevMC = this.centerMC;
- }
- else
- {
- this.centerMC.num = tMC.num - this.ballRadius;
- this.centerMC.prevMC = tMC;
- this.centerMC.nextMC = tMC.nextMC;
- if(tMC.nextMC != undefined)
- {
- tMC.nextMC.prevMC = this.centerMC;
- }
- else
- {
- this.prevMC = this.centerMC;
- }
- tMC.nextMC = this.centerMC;
- }
- this.centerMC.swapDepths(this.centerMC.Bnum + this.Depths);
- }
- }
- function getSameBall(cMC, ops)
- {
- var _loc4_ = 1;
- var _loc5_ = cMC._currentframe;
- var _loc2_ = cMC;
- while(_loc2_.prevMC != undefined)
- {
- if(_loc2_.prevMC._currentframe != _loc5_)
- {
- break;
- }
- if(!(ops == 1 || _loc2_.prevMC.num - _loc2_.num <= this.ballRadius))
- {
- break;
- }
- _loc2_ = _loc2_.prevMC;
- _loc4_ = _loc4_ + 1;
- }
- var _loc3_ = cMC.nextMC;
- while(_loc3_ != undefined)
- {
- if(_loc3_._currentframe != _loc5_)
- {
- break;
- }
- if(!(ops == 1 || _loc3_.prevMC.num - _loc3_.num <= this.ballRadius))
- {
- break;
- }
- _loc3_ = _loc3_.nextMC;
- _loc4_ = _loc4_ + 1;
- }
- if(_loc4_ >= 3)
- {
- return _loc2_;
- }
- return undefined;
- }
- function sameDeleteBall(tMC)
- {
- if(tMC.prevMC != undefined)
- {
- tMC.prevMC.mv = 0;
- }
- if(this.comboMC == undefined)
- {
- this.comboNum = 1;
- }
- else
- {
- this.comboNum = this.comboNum + 1;
- if(this.comboNum > this.maxCombo)
- {
- this.maxCombo = this.comboNum;
- }
- }
- var _loc4_ = this.comboNum * this.comboNum;
- if(_loc4_ < 2)
- {
- _loc4_ = 2;
- }
- var _loc5_ = tMC._currentframe;
- while(tMC != undefined)
- {
- if(tMC._currentframe != _loc5_)
- {
- break;
- }
- var _loc2_ = tMC;
- tMC = tMC.nextMC;
- if(_loc2_.num - _loc2_.nextMC.num > this.ballRadius)
- {
- this.deleteBall(_loc2_,_loc4_);
- break;
- }
- this.deleteBall(_loc2_,_loc4_);
- }
- this.soundPlay("explore",1);
- }
- function colorDeleteBall(Fnum)
- {
- var _loc3_ = this.prevMC;
- while(true)
- {
- if(_loc3_ == undefined)
- {
- break;
- }
- var _loc2_ = _loc3_;
- _loc3_ = _loc3_.prevMC;
- if(_loc2_._currentframe == Fnum)
- {
- this.deleteBall(_loc2_,1);
- _loc2_.mv = 0;
- }
- }
- }
- function moveHitBall()
- {
- if(this.prevMC != undefined)
- {
- var _loc3_ = undefined;
- var _loc2_ = this.prevMC;
- while(true)
- {
- var _loc4_ = this.distanceMC(this.centerMC,_loc2_);
- if(_loc4_ <= this.ballRadius)
- {
- if(_loc3_ != undefined && _loc4_ < this.distanceMC(this.centerMC,_loc3_))
- {
- _loc3_ = _loc2_;
- }
- else
- {
- _loc3_ = _loc2_;
- }
- }
- if(_loc2_.prevMC == undefined)
- {
- break;
- }
- _loc2_ = _loc2_.prevMC;
- }
- if(_loc3_ != undefined)
- {
- this.insertBall(_loc3_);
- if(this.centerMC._currentframe == this.lightningFrame && _loc3_._currentframe == this.lightningFrame)
- {
- this.deleteBall(this.centerMC,0);
- this.deleteBall(_loc3_,0);
- this.soundPlay("bomb",1);
- }
- else if(this.centerMC._currentframe == this.lightningFrame)
- {
- this.deleteBall(this.centerMC,0);
- this.colorDeleteBall(_loc3_._currentframe);
- this.soundPlay("bomb",1);
- }
- else if(_loc3_._currentframe == this.lightningFrame)
- {
- this.deleteBall(_loc3_,0);
- this.colorDeleteBall(this.centerMC._currentframe);
- this.soundPlay("bomb",1);
- }
- else
- {
- this.comboNum = 1;
- var _loc5_ = this.getSameBall(this.centerMC,0);
- if(_loc5_ != undefined)
- {
- var _loc6_ = _loc5_.prevMC;
- this.sameDeleteBall(_loc5_);
- if(_loc6_ != undefined)
- {
- this.getComboBall(_loc6_);
- }
- }
- }
- this.centerMC = undefined;
- _loc3_ = undefined;
- }
- }
- }
- function moveCenterBall()
- {
- this.shootMove += this.shootSpeed;
- var _loc2_ = this.shootRotation * 3.141592653589793 / 180;
- this.centerMC._x = this.shootMove * Math.cos(_loc2_) + this.centerX;
- this.centerMC._y = this.shootMove * Math.sin(_loc2_) + this.centerY;
- var _loc3_ = this.radius - this.shootRotation / 360 * 50;
- if(this.shootMove > _loc3_)
- {
- this.centerMC.removeMovieClip();
- this.centerMC = undefined;
- }
- else
- {
- this.moveHitBall();
- }
- }
- function moveScrewBall()
- {
- var _loc2_ = this.prevMC;
- if(_loc2_.num < this.ballRadius)
- {
- _loc2_.num = _loc2_.num + 1;
- }
- while(true)
- {
- if(_loc2_.prevMC != undefined)
- {
- if(_loc2_.prevMC.num - _loc2_.num <= this.ballRadius)
- {
- _loc2_.prevMC.num = _loc2_.num + this.ballRadius;
- }
- }
- if(_loc2_.num >= this.circleXY.length)
- {
- this.GameOver();
- break;
- }
- if(_loc2_.num < 0)
- {
- _loc2_._x = this.circleXY[0][0];
- _loc2_._y = this.circleXY[0][1] + _loc2_.num * 7;
- this.slotMC._y = this.slotMC.ty + _loc2_.num;
- }
- else
- {
- _loc2_._x = this.circleXY[_loc2_.num][0];
- _loc2_._y = this.circleXY[_loc2_.num][1];
- }
- if(_loc2_.prevMC == undefined)
- {
- break;
- }
- _loc2_ = _loc2_.prevMC;
- }
- }
- function getComboBall(cMC)
- {
- if(cMC != undefined && cMC.nextMC != undefined)
- {
- if(cMC._currentframe == cMC.nextMC._currentframe)
- {
- if(this.getSameBall(cMC,1) != undefined)
- {
- this.comboMC = cMC;
- this.soundPlay("combo",1);
- }
- }
- }
- }
- function moveComboBall()
- {
- if(this.comboMC != undefined && this.comboMC.nextMC != undefined)
- {
- var _loc3_ = this.comboMC.num - this.comboMC.nextMC.num - this.ballRadius;
- if(_loc3_ > this.backSpeed)
- {
- _loc3_ = this.backSpeed;
- }
- var _loc2_ = this.comboMC;
- while(true)
- {
- _loc2_.num -= _loc3_;
- _loc2_._x = this.circleXY[_loc2_.num][0];
- _loc2_._y = this.circleXY[_loc2_.num][1];
- if(_loc2_.prevMC == undefined)
- {
- break;
- }
- _loc2_ = _loc2_.prevMC;
- }
- if(_loc3_ <= 0)
- {
- var _loc4_ = this.getSameBall(this.comboMC,0);
- if(_loc4_ != undefined)
- {
- var _loc5_ = _loc4_.prevMC;
- this.sameDeleteBall(_loc4_);
- if(_loc5_ != undefined)
- {
- this.getComboBall(_loc5_);
- }
- }
- else
- {
- this.comboMC = undefined;
- }
- }
- }
- else
- {
- this.comboMC = undefined;
- }
- }
- function helpOnOff()
- {
- if(this.helpOn == true)
- {
- this.gameMC.HELP._visible = false;
- this.helpMC.gotoAndStop("OFF");
- this.helpOn = false;
- }
- else
- {
- this.gameMC.HELP._visible = true;
- this.helpMC.gotoAndStop("ON");
- this.helpOn = true;
- }
- }
- function soundOnOff()
- {
- if(this.soundOn == true)
- {
- this.soundMC.gotoAndStop("OFF");
- this.soundOn = false;
- stopAllSounds();
- }
- else
- {
- this.soundMC.gotoAndStop("ON");
- this.soundOn = true;
- }
- }
- function pauseOnOff()
- {
- if(this.pauseOn == true)
- {
- this.gameMC.PAUSE._visible = false;
- this.pauseMC.gotoAndStop("OFF");
- this.pauseOn = false;
- }
- else
- {
- this.gameMC.PAUSE._visible = true;
- this.pauseMC.gotoAndStop("ON");
- this.pauseOn = true;
- }
- }
- function soundPlay(name, loop)
- {
- if(this.soundOn == true && this.gameVolume > 0)
- {
- this.soundObj[name].start(0,loop);
- this.soundObj[name].setVolume(this.gameVolume);
- }
- }
- function sendRankScore(score, score_play)
- {
- if(_root.dbconnect == "yes")
- {
- sendObj = new LoadVars();
- loadObj = new LoadVars();
- sendObj.gametype = _root.gametype;
- sendObj.userid = _root.userid;
- sendObj.score = int(score) + 969696;
- sendObj.score_play = score_play;
- sendObj.sendAndLoad(_root.dir + "game_record." + _root.scripttype,loadObj,"POST");
- loadObj.onLoad = function()
- {
- };
- }
- }
- System.useCodepage = true;
- this._name = "AS";
- var gameMC = _parent.GAME;
- var startMC = _parent.STARTBUTTON;
- this.startMC.swapDepths(20001);
- var f = 0;
- var Bnum = 1;
- var Bmax = 10000;
- var Depths = 100;
- var circleXY = [];
- var centerTmp = undefined;
- var screwTmp = undefined;
- var centerMC = undefined;
- var shoot = false;
- var shootRotation = 0;
- var shootMove = 0;
- var shootSpeed = 15;
- var backSpeed = 8;
- var lineMC = this.gameMC.LINEMC;
- var slotMC = this.gameMC.SLOTMC;
- var prevMC = undefined;
- var comboMC = undefined;
- var comboNum = 0;
- var maxCombo = 0;
- var gameplay = false;
- var TotalScore = 0;
- var ballMaxNum = ballMaxMin = 4;
- var ballMaxCount = 9;
- var ballMaxArr = [30,500,1000,2000,3000,5000,10000,30000,50000];
- var lightningFrame = 10;
- var lightningRand = 180;
- var CountBall = 0;
- var maxRotation = 920;
- var maxDistance = 45;
- var HitAreaX1 = 10;
- var HitAreaY1 = 10;
- var HitAreaX2 = 410;
- var HitAreaX2 = 410;
- var startTime = 0;
- var test = false;
- this.onEnterFrame = function()
- {
- var _loc5_ = false;
- if(this.pauseOn == false && this.gameplay == true)
- {
- if(this.comboMC == undefined)
- {
- this.f += 1;
- if(this.f >= this.ballRadius)
- {
- this.f = 0;
- this.AddScrewBall();
- }
- this.MouseLine();
- if(this.prevMC != undefined)
- {
- this.moveScrewBall();
- }
- if(this.shoot == true)
- {
- this.moveCenterBall();
- }
- if(this.centerMC == undefined)
- {
- this.AddCenterBall();
- }
- var _loc4_ = _parent._xmouse;
- var _loc3_ = _parent._ymouse;
- if(_loc4_ >= this.HitAreaX1 && _loc4_ <= this.HitAreaX2 && _loc3_ >= this.HitAreaY1 && _loc3_ <= this.HitAreaX2)
- {
- _loc5_ = true;
- }
- }
- else
- {
- this.moveComboBall();
- }
- }
- if(_loc5_)
- {
- this.lineMC.gotoAndStop(2);
- }
- else
- {
- this.lineMC.gotoAndStop(1);
- }
- if(this.test)
- {
- _parent.TXT = "ball: " + this.CountBall + ", combo: " + this.maxCombo + ", Kind: " + this.ballMaxNum;
- }
- };
- this.onMouseDown = function()
- {
- if(this.pauseOn == false && this.helpOn == false && this.gameplay == true && this.centerMC != undefined && this.shoot == false)
- {
- var _loc4_ = _parent._xmouse;
- var _loc3_ = _parent._ymouse;
- if(_loc4_ >= this.HitAreaX1 && _loc4_ <= this.HitAreaX2 && _loc3_ >= this.HitAreaY1 && _loc3_ <= this.HitAreaX2)
- {
- this.shootRotation = this.rotationXY(_loc4_,_loc3_,this.centerX,this.centerY);
- this.shoot = true;
- this.shootMove = 0;
- this.soundPlay("shoot",1);
- }
- }
- };
- this.onUnload = function()
- {
- this.unSet();
- this.lineMC.removeMovieClip();
- this.slotMC.removeMovieClip();
- };
- this.stop();
- var helpOn = false;
- var helpMC = _parent.helpMC;
- this.helpMC.gotoAndStop("OFF");
- this.gameMC.HELP._visible = false;
- var soundOn = true;
- var soundMC = _parent.soundMC;
- this.soundMC.gotoAndStop("ON");
- var pauseOn = false;
- var pauseMC = _parent.pauseMC;
- this.pauseMC.gotoAndStop("OFF");
- this.gameMC.PAUSE._visible = false;
- var soundName = ["title","shoot","explore","combo","bomb"];
- var soundObj = Array();
- if(this.gameVolume < 0)
- {
- this.gameVolume = 0;
- }
- if(this.gameVolume > 1000)
- {
- this.gameVolume = 1000;
- }
- var i = 0;
- while(i <= soundName.length)
- {
- soundObj[soundName[i]] = new Sound();
- soundObj[soundName[i]].attachSound(soundName[i]);
- i++;
- }
-